<template>
  <div class="news_details">
    <div class="news_details_nav">
      <p style="margin-right: 20px">公告详情</p>
    </div>
    <div class="news_details_content">
      <h1>{{ announcementDetails.title }}</h1>
      <p class="news_details_content_time">
        发布时间：{{ announcementDetails.createdAt }}
      </p>
      <p class="news_details_content_time">
        更新时间：{{ announcementDetails.updatedAt }}
      </p>
      <div class="news_details_content_paragraph">
        <p v-html="announcementDetails.content"></p>
      </div>
    </div>
  </div>
</template>

<script>
import { findAnnouncementById } from "@/api/home";
export default {
  name: "news_details",
  data() {
    return {
      announcementDetails: {},
    };
  },
  created() {},
  mounted() {
    this.findAnnouncementById();
  },
  methods: {
    findAnnouncementById() {
      findAnnouncementById(this.$route.query.annId).then((response) => {
        if (response.data.code === 20000) {
          const { content, createdAt, id, title, updatedAt } =
            response.data.results;
          let obj = {
            content,
            createdAt,
            id,
            title,
            updatedAt,
          };
          this.announcementDetails = obj;
        }
      });
    },
  },
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.news_details {
  color: #333;
  .news_details_nav {
    height: 40px;
    background: #f1f1f1;
    text-align: right;
    line-height: 40px;
    font-weight: bold;
    font-size: 21px;
    color: #0a7b19;
  }
  .news_details_content {
    margin-top: 40px;
    margin-bottom: 110px;
    h1 {
      width: 100%;
      text-align: center;
    }
    .news_details_content_time {
      margin-top: 25px;
      font-size: 12px;
      width: 100%;
      text-align: center;
    }
    .news_details_content_paragraph {
      margin-top: 30px;
      font-size: 14px;
      line-height: 24px;
      img {
        max-width: 600px;
        margin-bottom: 20px;
      }
    }
  }
}
</style>
